package com.ss.project.xia17user.rest;

import com.ss.project.xia17user.config.security.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
import org.thymeleaf.spring5.view.reactive.ThymeleafReactiveViewResolver;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;

/**
 * @author xia17
 * @date 2020/9/18 10:34
 */
@Controller
@RequiredArgsConstructor
@Slf4j
public class TemplateController {

    /**
     * 登录页面
     * @return /
     */
    @GetMapping("login")
    public String login(Model model){
        return "login";
    }


    /**
     * 首页
     * @return /
     */
    @ResponseBody
    @GetMapping("/")
    public String index(){
        return SecurityUtils.username();
    }






}
